import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import { createPinia } from 'pinia'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
// 如果使用了 Element Plus 的图标，需要导入
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import './router/permission'  // 添加这行，引入路由守卫

const app = createApp(App)
const pinia = createPinia()

// 注册所有图标
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}

app.use(pinia)  // 确保 pinia 在 router 之前注册
app.use(router)
app.use(ElementPlus)

app.mount('#app') 